/**
 * v-call
 * 拨打电话
 * 接收参数：string类型/Ref<string>类型/Reactive<string>类型
 */
let phoneNumber = ''
const call = {
	bind(el, binding) {
		phoneNumber = binding.value;
		el.addEventListener("click", handleClick);
	},
	componentUpdated(el, binding) {
		phoneNumber = binding.value;
	},
	unbind(el) {
		el.removeEventListener("click", el.handleClick);
	}
};
function handleClick() {
	if (!phoneNumber) return uni.showToast({
		title: '手机号不能为空',
		mask: true,
		icon: 'error'
	})
	uni.makePhoneCall({
		phoneNumber,
	})
}
export default call;
